home *** CD-ROM | disk | FTP | other *** search
/ Macademic for Students & Teachers / Macademic for Students and Teachers (Quantum Leap)(1992).iso / General Interest / Whole Earth Catalog⁄stack / stack_-1.xml < prev    next >
Extensible Markup Language  |  1987-09-20  |  4KB  |  16 lines

  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE stack PUBLIC "-//Apple, Inc.//DTD stack V 2.0//EN" "" >
  3. <stack>
  4.     <name>in</name>
  5.     <id>-1</id>
  6.     <cardCount>20</cardCount>
  7.     <cardID>2944</cardID>
  8.     <listID>2093</listID>
  9.     <cantModify><false /></cantModify>
  10.     <cantDelete><false /></cantDelete>
  11.     <cantAbort><false /></cantAbort>
  12.     <cardSize>
  13.         <width>512</width>
  14.         <height>342</height>
  15.     </cardSize>
  16.     <script>on idleset lockscreen to falseend idlefunction getLine fileName-- read one line from the fileread from file fileName until returnput it into msgreturn (it)end getLinefunction terminator thisLine-- is thisLine a message terminator?global terminatorsif char 1 to 5 of thisLine is "Topic" and char 10 of thisLine is ":" ¬¨then return truerepeat with i = 1 to number of lines in terminatorsif line i of terminators is in thisLine then return trueend repeatreturn falseend terminatorfunction getNum thisLine-- crack the leading number from a contents lineput offset(":", thisLine) into endHerereturn value(char 1 to endHere - 1 of thisLine)end getNumfunction insertLine theField,thisNum,thisLine-- figure out where the new line should go in contents-- blank contents?if bkgnd field theField is empty thenput thisLine into bkgnd field theFieldreturn 1end if-- at end? (the most common case - checked first)if getNum(last line of bkgnd field theField) < thisNum thenput thisLine after bkgnd field theFieldreturn number of lines in bkgnd field theFieldend if-- all right, do it the hard wayrepeat with i = 1 to number of lines in bkgnd field theFieldif thisNum < getNum(line i of bkgnd field theField) thenput thisLine before line i of bkgnd field theFieldreturn iend ifend repeatend insertLineon addText newText-- concatenate to global text object, observing size limitglobal theText, textLengthadd length(newText) to textLengthif textLength > 29990 then exit addTextput newText after theTextend addTextfunction slurpText fileName,discard,putHere-- skip null lines, build message, paste into card-- return terminating line for analysisglobal theText, textLengthrepeat discardput getline(fileName) into fooend repeatput empty into theTextput 0 into textLengthrepeat-- pull in the message text-- done offscreen for performance reasons (no redraws)put getLine(fileName) into theLineif terminator(theLine) then exit repeataddText theLineend repeatput theText into bkgnd field putHerereturn theLineend slurpTexton setID topicID,idLine-- put id of this card into hidden link field of topic header cardif idLine is 0 then exit setIDget the id of this cardput it into line idLine of field "theLinks" of card id (word 3 of topicID)end setIDon import-- don't try to understand the details without a WELL transcript!global terminatorsask "Please enter name of text file:"if it is empty then exit importput it into fileNameopen file fileNameput "Interrupt!" & return & "(r)espond" & return & "responses total."¬¨into terminatorsrepeatput getLine(fileName) into theLineif theLine is empty then exit repeatrepeat while char 1 to 5 of theLine is "Topic" ¬¨and char 10 of theLine is ":"delete last char of theLinedelete char 11 of theLinedelete char 1 to 5 of theLineput getNum(theLine) into topicNumput topicNum into char 1 to 4 of theLineif theLine is not in field "theTopics" of card "Conference" then-- There is no Topic line in the Conference cardgo to card "Conference"put char 1 to 65 of theLine & return into theLineput insertLine("theTopics", topicNum, theLine) into fooend ifput theLine into topicLinego to card ("Topic" & topicNum) of bkgnd "Topic"if the result is not empty then-- There is no Topic header card for this topicgo to card 1 of bkgnd "Topic"doMenu Copy Cardgo to last carddoMenu Paste Cardset the name of this card to "Topic" & topicNumput theLine into bkgnd field "theTopic"-- read author lineput getLine(fileName) into theLineif char 1 to 4 of theLine is "By: " then-- This is originator's messagedelete char 1 to 4 of theLineput offset("